package at.fhh.se.tjr.client.model;
import at.fhh.se.tjr.client.controller.Controller;
import at.fhhagenberg.se.tjr.protocol.Message;

import com.sentilla.net.Receiver;
import com.sentilla.net.ReceiverDriver;

public class ReceiverThread extends Thread {

	public void run() {
		Object obj = new Object();
		Receiver recv = ReceiverDriver.create(obj.getClass());
		while (true) {
			obj = recv.receive();
			try {
				Controller.getInstance().getMessageQueue().add((Message)obj);
				Controller.getInstance().addMessageToTable((Message)obj);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

}
